#include <iostream>
#include <fstream>
#include <vector>
#include "../utils.h"
#include "../splines.h"
using namespace std;

ostream& operator<<(ostream& o, const pol& p) {
	bool nf=true;
	dforn(i,p.size()) {
		if (p[i]==0.0) continue;
		if (nf) nf=false; else o << " + ";
		o << p[i];
		if (i>0) o << "*x";
		if (i>1) o << "^" << i;
	}
	return o;
}

int main(int argc, char *argv[]) {
	if (argc!=2) {
		cout << "USO: testSplines archivoEntrada" << endl;
		return 1;
	}
	ifstream in(argv[1]);
	int n;
	in >> n;
	vector<double> pts(n);
	forn(i,n) in >> pts[i];
	forn(i,n) cout << pts[i] << " "; cout << endl;
	spline s=app(pts);
	forn(i,n) cout << s[i] << endl;
	return 0;
}
